Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstrings to show short_help when running --help #2542

Merged
merged 4 commits into from
Jul 12, 2018
Merged

Add docstrings to show short_help when running --help #2542

merged 4 commits into from
Jul 12, 2018

Conversation

sup
Copy link
Contributor

@sup sup commented Jul 9, 2018

Description

This addresses #2381 by adding docstrings to cli commands which allows Click to display some informative help text when running --help. This change simply maps the existing short_help field to a docstring.

Moreover, this doesn't cause the truncation issue mentioned in #2381 becauseshort_help is already defined and overrides the 45 character truncation Click uses by default. Indeed, running pipenv --help locally results in status quo behavior:

Commands:
  check      Checks for security vulnerabilities and against PEP 508 markers
             provided in Pipfile.
  clean      Uninstalls all packages not specified in Pipfile.lock.
  graph      Displays currently-installed dependency graph information.
  install    Installs provided packages and adds them to Pipfile, or (if none
             is given), installs all packages.
  lock       Generates Pipfile.lock.
  open       View a given module in your editor.
  run        Spawns a command installed into the virtualenv.
  shell      Spawns a shell within the virtualenv.
  sync       Installs all packages specified in Pipfile.lock.
  uninstall  Un-installs a provided package and removes it from Pipfile.
  update     Runs lock, then sync.

Result

$ pipenv check --help
Usage: pipenv check [OPTIONS] [ARGS]...

  Checks for security vulnerabilities and against PEP 508 markers provided
  in Pipfile.

Options:
  --three / --two     Use Python 3/2 when creating virtualenv.
  --python TEXT       Specify which version of Python virtualenv should use.
  --system            Use system Python.
  --unused TEXT       Given a code path, show potentially unused dependencies.
  -i, --ignore TEXT   Ignore specified vulnerability during safety checks.
  --pypi-mirror TEXT  Specify a PyPI mirror.
  -h, --help          Show this message and exit.

@erinxocon
Copy link
Contributor

Hi @sup! Thanks for this, I am not against changing this however I’m going to need BDFL (@kennethreitz 🙂) approval since it’s an API change technically.

@sup
Copy link
Contributor Author

sup commented Jul 9, 2018

Sure thing!

@erinxocon
Copy link
Contributor

BDFL gave their ok, merging!

@erinxocon
Copy link
Contributor

Hey @sup, I messed up and merged the PR and then reverted it to a bug I thought was in this PR, but was not. Could you reopen a PR so I can merge it proper?

@sup
Copy link
Contributor Author

sup commented Jul 12, 2018

@erinxocon oh yeah sure thing! Thanks for the info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants